package com.aoip.telemetry.telemetry.entity.common;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * 合并表数据
 * @author chenbai
 * @version 1.0
 * @date 2022/4/17 10:26
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode(callSuper = false)
@TableName("st_data_merge_config")
@ApiModel(value = "entity对象", description = "本表存储元素解析入库前，需要合并的字段信息")
public class MergeTableDataEntity implements Serializable {

    private static final long serialVersionUID = -1954040291895834577L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ApiModelProperty("数据id")
    private String id;

    @ApiModelProperty(value = "插入表名")
    @TableField("table_name")
    private String tableName;

    @ApiModelProperty(value = "数据关联测站名")
    @TableField("st_code")
    private String stCode;

    @ApiModelProperty(value = "待合并字段，多个字段以逗号分隔")
    @TableField("merge_column")
    private String mergeColumn;

    @ApiModelProperty(value = "过滤限制条件字段，多个字段以逗号分隔")
    @TableField("limit_column")
    private String limitColumn;

    /**
     * 合并字段
     **/
    @ApiModelProperty(value = "过滤限制条件字段，多个字段以逗号分隔")
    @TableField(exist = false)
    private Map<String, Object> mergeColumnFieldMap;
    /**
     * 限制条件
     **/
    @TableField(exist = false)
    private Map<String, Object> limitColumnFieldMap;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifyTime;

    @ApiModelProperty(value = "逻辑删除字段，0已删除，1未删除")
    @TableField(value = "del_flag", fill = FieldFill.INSERT_UPDATE)
    @TableLogic
    private Integer delFlag;
}
